/**
 * Created by Administrator on 2017/3/7 0007.
 */
var Page3= {
    create: function () {
        var page = {};

        var tw_t0,tw_t1,tw_t2,tw_bg,tw_cover,tw_whole;

        page.ui = new PIXI.DisplayObjectContainer();
        var bg = new PIXI.Sprite(resource['assets/images/page0_bg.png'].texture);
        bg.alpha = 0;
        page.ui.addChild(bg);

        var bgWomen=new PIXI.Sprite(resource['assets/images/page3_mask.png'].texture);
        bgWomen.x=-50;
        bgWomen.alpha=0;
        page.ui.addChild(bgWomen);

        var t0y=143;
        var t0=new PIXI.Sprite(resource['assets/images/page3_t0.png'].texture);
        t0.scale.x=t0.scale.y=0.8;
        t0.x=1136/2;
        t0.y=t0y;
        t0.alpha=0;
        t0.anchor.set(0.5);
        page.ui.addChild(t0);

        var t1y=272;
        var t1=new PIXI.Sprite(resource['assets/images/page3_t1.png'].texture);
        t1.x=1136/2;
        t1.y=t1y;
        t1.alpha=0;
        t1.anchor.set(0.5);
        // page.ui.addChild(t1);

        var t2y=225;
        var t2=new PIXI.Sprite(resource['assets/images/page3_t2.png'].texture);
        t2.x=1136/2;
        t2.y=t2y;
        t2.alpha=0;
        t2.anchor.set(0.5);
        page.ui.addChild(t2);

        tw_bg=new TWEEN.Tween({alpha:0})
            .to({alpha:1},1000)
            .onUpdate(function () {
                bg.alpha=this.alpha;
            })
            .easing(TWEEN.Easing.Cubic.Out)
            .start();
        tw_cover=new TWEEN.Tween({alpha:0})
            .to({alpha:1},1000)
            .delay(500)
            .onUpdate(function () {
                bgWomen.alpha=this.alpha;
            })
            .onComplete(function () {
                new TWEEN.Tween({alpha:1})
                    .to({alpha:0},1000)
                    .delay(3000)
                    .onUpdate(function () {
                        bgWomen.alpha=this.alpha;
                    })
                    .start()
            })
            // .easing(TWEEN.Easing.Cubic.Out)
            .start();

        tw_t0=new TWEEN.Tween({alpha:0,y:t0y+30})
            .to({alpha:1,y:t0y},1000)
            .delay(4500)
            .onUpdate(function () {
                t0.alpha=this.alpha;
                t0.y=this.y;
            })
            .easing(TWEEN.Easing.Back.Out)
            .start();
        tw_t1=new TWEEN.Tween({alpha:0,y:t1y+30})
            .to({alpha:1,y:t1y},1000)
            .delay(4700)
            .onUpdate(function () {
                t1.alpha=this.alpha;
                t1.y=this.y;
            })
            .easing(TWEEN.Easing.Back.Out)
            .start();
        tw_t2=new TWEEN.Tween({alpha:0,scaleX:0,scaleY:0})
            .to({alpha:1,scaleX:1,scaleY:1},700)
            .onUpdate(function () {
                t2.alpha=this.alpha;
                t2.scale.x=this.scaleX;
                t2.scale.y=this.scaleY;
            })
            .delay(5000)
            .easing(TWEEN.Easing.Cubic.Out)
            .start();

        return page;
    }
}
